﻿using SmartSpace.Core;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PublishTool
{
    public class PTDbContext : DbContext
    {
        public PTDbContext(string connectionString)
            : base(connectionString)
        {
            Database.SetInitializer<CoreDbContext>(null);
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Module>().ToTable("__Module");
            modelBuilder.Entity<Module>().HasKey(p => p.Id);

            modelBuilder.Entity<ModuleView>().ToTable("__ModuleView");
            modelBuilder.Entity<ModuleView>().HasKey(p => p.Id);

            modelBuilder.Entity<Theme>().ToTable("__Theme");
            modelBuilder.Entity<Theme>().HasKey(p => p.Id);

            base.OnModelCreating(modelBuilder);
        }
    }
}
